//
//  LiJiHuanKuanViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/5.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewTiXianViewController.h"
#import "JTCSM.h"
#import "NewKuaiPayViewController.h"

static CGFloat top = 15;
static CGFloat space = 20;
static CGFloat imagesize = 60;
static CGFloat labelHeight = 30;
static CGFloat height = 50;
@interface NewTiXianViewController ()<UINavigationControllerDelegate>
{
    UIImageView *headerImagev;
    UILabel *banknameLabel;
    UILabel *bankcardLabel;
    UITextField *moneyTextfield;

    UILabel *moneylabel;
    UILabel *titleLabel;
    UIView *lineview;
}
@end

@implementation NewTiXianViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = NO;
    [df isRemoveTarbar:YES];
    self.view.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    // Do any additional setup after loading the view.
    [self layoutview];
    self.navigationController.delegate = self;

}
// 将要显示控制器
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)layoutview{
    
    
    [df lineViewWithHeightofTop:top superView:self.view spacing:-150 color:RGBACOLOR(241, 241, 241, 1) lineHeight:top];
    UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(10, top+KagainChangeHeight, KCONTROLLERWith-20, 115)];
    backview.backgroundColor = [UIColor whiteColor];
    [df layerWithView:backview radius:4 width:0 color:nil];
    [self.view addSubview:backview];
    headerImagev = [[UIImageView alloc]initWithFrame:CGRectMake(space, top*2+(labelHeight*2-imagesize)/2, imagesize, imagesize)];
    [backview addSubview:headerImagev];
    headerImagev.image = [UIImage imageNamed:@"个人信息1_头像.png"];
    
    banknameLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(headerImagev)+space, top*2, KSCREENWidth, labelHeight) text:@"招商银行" font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(89, 89, 89, 1) backgroundColor:nil];
    [backview addSubview:banknameLabel];
    
    bankcardLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(headerImagev)+space, KVIEW_Y(banknameLabel), KSCREENWidth, labelHeight) text:@"123312312312" font:16 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(89, 89, 89, 1) backgroundColor:nil];
    [backview addSubview:bankcardLabel];
    
    [df lineViewWithHeightofTop:KVIEW_Y(backview)+top superView:self.view spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:top];
    
    UIView *bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, KVIEW_Y(backview)+top, KCONTROLLERWith, 120)];
    bottomView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:bottomView];
    
    NSString *titleStr = @"¥";
    float fontsize = 28;
    CGRect rect = [df labelHeightWithContent:titleStr height:30 font:fontsize];
    
    UILabel *$label =[UILabel initWithFrame:CGRectMake(20, (70-rect.size.height)/2, rect.size.width, rect.size.height) text:titleStr font:fontsize textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
    [bottomView addSubview:$label];
    
    moneyTextfield = [UITextField initWithframe:CGRectMake(KVIEW_X($label)+10, $label.LC_y+4, KCONTROLLERWith, rect.size.height) backgrandColor:nil placeholder:@"输入提现金额" textAlignment:NSTextAlignmentLeft font:14 texcolor:RGBACOLOR(51,51,51,1)];
    [bottomView addSubview:moneyTextfield];
    moneyTextfield.keyboardType = UIKeyboardTypeNumbersAndPunctuation; 
   
    [df newlineViewWithHeightofTop:70 superView:bottomView spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
    UIView *bankView = [[UIView alloc]initWithFrame:CGRectMake(0, 70, KCONTROLLERWith, height)];
    [bottomView addSubview:bankView];
    bottomView.userInteractionEnabled = YES;
    backview.userInteractionEnabled = YES;
   
    moneylabel = [UILabel initWithFrame:CGRectMake(20, 0, KCONTROLLERWith/2-20, height) text:@"" font:14 textAlignment:NSTextAlignmentLeft texcolor:[df colorWithHexString:@"999999" alpha:1] backgroundColor:nil];
    [bankView addSubview:moneylabel];
    
    CGRect rect1 = [df labelHeightWithContent:@"全部体现" width:1000 font:14];
   titleLabel = [UILabel initWithFrame:CGRectMake(KCONTROLLERWith-space-rect1.size.width, (height-rect1.size.height-2)/2, rect1.size.width, rect1.size.height+2) text:@"全部体现" font:14 textAlignment:NSTextAlignmentLeft texcolor:[df colorWithHexString:@"ff3636" alpha:1] backgroundColor:nil];
    [bankView addSubview:titleLabel];
    titleLabel.userInteractionEnabled = YES;
   lineview =[df newlineViewWithHeightofTop:rect1.size.height+1 superView:titleLabel spacing:0 color:[df colorWithHexString:@"ff3636" alpha:1] lineHeight:1];
    [df addTapGestureRecognizerWithTarget:self action:@selector(quanbutixian) andaddView:backview];
    [self setValueWithMoney:1447845.00];
    
    UIButton *tijiaobutton = [UIButton buttonWithType:UIButtonTypeCustom];
    tijiaobutton.frame = CGRectMake(25, KVIEW_Y(bottomView)+30, KCONTROLLERWith-40, 50);
    [tijiaobutton addTarget:self action:@selector(tijiao) forControlEvents:UIControlEventTouchUpInside];
    [df layerWithView:tijiaobutton radius:25 width:0 color:nil];
    tijiaobutton.backgroundColor = KZhuTiRGB;
    [tijiaobutton setTitleColor:RGBACOLOR(51, 51, 51, 1) forState:UIControlStateNormal];
    [tijiaobutton setTitle:@"确认还款" forState:UIControlStateNormal];
    [self.view addSubview:tijiaobutton];
    NSString *alertStr = @"次日到账，节假日顺延";
    CGRect alertrect = [df labelHeightWithContent:alertStr height:20 font:12];
    UILabel *alertLabel = [UILabel initWithFrame:CGRectMake(0, KVIEW_Y(tijiaobutton)+12, KCONTROLLERWith, alertrect.size.height) text:alertStr font:12 textAlignment:NSTextAlignmentCenter texcolor:RGBACOLOR(102, 102, 102, 1) backgroundColor:nil];
    [self.view addSubview:alertLabel];
    
}
- (void)tijiao{
    NewKuaiPayViewController *vc = [[NewKuaiPayViewController alloc]init];
    vc.nameTitle = @"快捷支付";
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)setValueWithMoney:(float)money{
    NSString *str = [NSString stringWithFormat:@"可用余额¥%.2f，",money];
    moneylabel.text = str;
    CGRect rect = [df labelHeightWithContent:str width:1000 font:14];
    moneylabel.frame =CGRectMake(moneylabel.LC_x, moneylabel.LC_y, rect.size.width, height);
    titleLabel.frame = CGRectMake(KVIEW_X(moneylabel), (height-rect.size.height-2)/2, titleLabel.LC_width, rect.size.height+2);
    [lineview removeFromSuperview];
    lineview =[df newlineViewWithHeightofTop:rect.size.height+1 superView:titleLabel spacing:0 color:[df colorWithHexString:@"ff3636" alpha:1] lineHeight:1];
}
- (void)quanbutixian{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end

